<template>
  <div class="app">
      
    
    <mt-header fixed title="blackhorse">
      <router-link to="/" class="app_a" slot="left">
         返回
      </router-link>
    </mt-header>
    <transition name="app">
       <router-view/>
    </transition>
    <div class="nav">
      <router-link to="/home" tag="div" class="nav_bar">首页</router-link>
      <router-link to="/member" tag="div" class="nav_bar">会员</router-link>
      <router-link to="/shopcart" tag="div" class="nav_bar">
      购物车
      <div class="nav_bar_number" id="number">{{this.$store.getters.getcount}}</div>
      <!-- <div class="nav_bar_number" id="number">{{this.$store.getters.getAllcount}}</div> -->
      </router-link>
      <router-link to="/search" tag="div" class="nav_bar">搜索</router-link>
    </div>
  </div>
</template>
<script>
  export default{
    data(){
      return{
        selected:false,
        count:this.$store.getters.getAllcount
      }
    },
    methods:{
      getcart(){
        var cart = JSON.parse(localStorage.getItem('cart') || []);
        console.log(cart);
        this.$store.commit('gettocart',cart)
      }
    },
    created(){
      this.getcart()

    }
    
  }
</script>
<style>
*{
  margin:0;
  padding:0;
}
.app {
  padding-top:40px;
  padding-bottom:44px;
  box-sizing: border-box;
  overflow-x: hidden;
}
.nav{
  width:100%;
  height: 44px;
  display: flex;
  flex-direction: row;
  align-items: center;
  position: fixed;
  left:0;
  bottom:0;
  border-top:1px solid #e2e2e2;
  /* z-index: 999999; */
  background-color: #FFF;
}
.nav_bar{
  width:25%;
  height: 44px;
  display:flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  font-size:16px;
  color:#333;
  position: relative;
}
.router-link-active{
  color:#26A2FF;
}
.app-enter{
  opacity: 0;
  transform: translateX(100%);
}
.app-leave-to{
  opacity: 0;
  transform: translateX(-100%);
  position: absolute;
}
.app-leave-active,
.app-enter-active{
  transition: all 0.6s ease;
}
.app_a{
  text-decoration: none;
}
.nav_bar_number{
  width:20px;
  height: 20px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  background-color: red;
  color:#FFF;
  font-size:0.16rem;
  border-radius: 50%;
  position: absolute;
  top:0px;
  right:10px;
}

</style>
